<?php

namespace App\Http\Repositories\Relation;

use App\Http\Repositories\Repository;
use App\Models\TypeObjectRelation;

/**
 * 类型对象关联
 */
class TypeObjectRepo extends Repository
{
    const MODEL = TypeObjectRelation::class;

    public function getObjectIdByTypeIds(string $type_ids,int $type)
    {
        $type_ids= explode(',', $type_ids);
        $result = $this->query()->select('object_id')->whereIn('type_id', $type_ids)->get();

        $result = !empty($result) ? $result->toArray() : [];

        return array_column($result, 'object_id');
    }
}
